package com.xu.controller;

import com.xu.pojo.Movie;
import com.xu.pojo.MovieDetail;
import com.xu.service.MovieDetailService;
import com.xu.service.MovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

@Controller
public class MovieDetailController {
    @Autowired
    private MovieDetailService movieDetailService;
    @Autowired
    private MovieService movieService;

    @RequestMapping("/movieDetail/{id}")
    public String getMovieDetail(Model model, @PathVariable int id){
        Movie movie = movieService.queryMovieById(id);
        model.addAttribute("movie",movie);

        return "movieDetail";
    }
}
